<?php
/**
 * Larfree Api类
 * @author blues
 */
namespace App\Http\Controllers\Api\User;
use Illuminate\Http\Request;
use Larfree\Controllers\ApisController as Controller;
use App\Models\User\UserHistory;
class HistoryController extends Controller
{
    public function __construct(UserHistory $model)
    {
        $this->model = $model;
        parent::__construct();
    }

    public  function  index(Request $request)
    {
        $userID=getLoginUserID();
        if(isset($type )&& $type=='index'){
            $this->model=$this->model->where('user_id',$userID)->orderBy('updated_at','desc')->orderBy('id','desc')->link()->limit(4);
        }
        else{
         $this->model=$this->model->where('user_id',$userID)->orderBy('updated_at','desc')->orderBy('id','desc')->link();
        }
        return parent::index($request); // TODO: Change the autogenerated stub
    }
}